/**
 * 
 */
package jetty;

import javax.servlet.Servlet;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;

import beans.soap.SOAPServlet;

/**
 * @author Beanstao@gmail.com
 * @date 2013-10-9
 * @version 1.0
 */
public class ServerStartUp
{
	public static void main(String[] args)
	{
		start();
	}

	private static Server server;

	public static void start()
	{
		server = new Server(7077);

		ServletContextHandler hand = new ServletContextHandler();
		hand.addServlet((Class<? extends Servlet>) SOAPServlet.class, "/SOAPServlet");
		server.setHandler(hand);
		try
		{
			server.start();
			System.out.println("ServerStartUp.start()" + "开启服务");
			server.join();
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}

	public static void stop()
	{
		if (server != null)
			try
			{
				System.out.println("ServerStartUp.stop()" + "停止服务");
				server.stop();
			}
			catch (Exception e)
			{
				e.printStackTrace();
			}
	}

}
